<?php

/**
 * Description of Message
 *
 * @author pahhan
 */
class Model_Message extends ORM
{
    protected $_table_name = 'message';

    public function getId()
    {
        return $this->get('id');
    }

    public function setParseInfoId($value)
    {
        $this->set('parse_info_id', $value);
        return $this;
    }

    public function setExternalId($value)
    {
        $this->set('external_id', $value);
        return $this;
    }

    public function getExternalId()
    {
        return $this->get('external_id');
    }

    public function setPublishedAt($value)
    {
        $this->set('published_at', $value);
        return $this;
    }

    public function setTitle($value)
    {
        $this->set('title', $value);
        return $this;
    }

    public function setContent($value)
    {
        $this->set('content', $value);
        return $this;
    }

    public function setTags($value)
    {
        $this->set('tags', $value);
        return $this;
    }

    public function setSize($value)
    {
        $this->set('size', $value);
        return $this;
    }

    public function setUpdatedAt($value)
    {
        $this->set('updated_at', $value);
        return $this;
    }

    public function setIsBlocked($value)
    {
        $this->set('is_blocked', $value);
        return $this;
    }

    public function calculateSize()
    {
        return strlen($this->title.$this->content.$this->tags.$this->external_id);
    }

    public function save(Validation $validation = NULL)
    {
        $this->setUpdatedAt(date('Y-m-d H:i:s'));
        parent::save($validation);
    }
}

